/***************************************************************************
 *
 *   copyright            : (C) 2005 Winds of Storm
 *
 *   $Id: db.h,v 1.8 2005/12/31 01:36:17 nathan Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#ifdef	DBTYPE_MYSQL
#include <mysql.h>

typedef struct st_mysql_res	DB_RES;
//typedef struct st_mysql_rows	DB_ROW;
typedef char			**DB_ROW;
typedef struct st_mysql		DB_CONN;
#endif

#ifdef	DBTYPE_PQSQL
#include <libpq-fe.h>

typedef	PGconn		DB_CONN;
typedef PGresult	DB_RES;
typedef char		**DB_ROW;
#endif

//
// functions from db.c
//
DB_CONN	*db_connect(void);
DB_RES	*db_query(DB_CONN *conn, char *sql_st);
DB_ROW	db_fetch_row(DB_RES *results, int row_num);
void	db_clean_results(DB_RES *results);
void	db_disconnect(DB_CONN *conn);
int     db_num_rows(DB_RES *results);
void	db_thread_init(DB_CONN *conn);
void	db_thread_end(DB_CONN *conn);
void	db_noop(DB_CONN *conn);
